Merges n-number of ordered enumerations based on the comparer provided.
Syntax
Parameters
- comparer
- duplicateHandling
- enums
Example
Library/Library.Test/TestOrderedEnumeration.cs
C# | Copy Code |
---|
char[] x = "aeiou".ToCharArray();
char[] y = "bcdfg".ToCharArray();
char[] z = "ez".ToCharArray();
var order = OrderedEnumeration<char>.Merge(x, y, z);
Assert.AreEqual("abcdeefgiouz", new string(new List<char>(order).ToArray()));
order = OrderedEnumeration<char>.Merge(Comparer<char>.Default, DuplicateHandling.LastValueWins, x, y, z);
Assert.AreEqual("abcdefgiouz", new string(new List<char>(order).ToArray()));
order = OrderedEnumeration<char>.Merge(Comparer<char>.Default, x, y);
order = OrderedEnumeration<char>.WithDuplicateHandling(order, Comparer<char>.Default,
DuplicateHandling.FirstValueWins);
Assert.AreEqual("abcdefgiou", new string(new List<char>(order).ToArray())); |
VB.NET | Copy Code |
---|
Dim x As Char() = "aeiou".ToCharArray()
Dim y As Char() = "bcdfg".ToCharArray()
Dim z As Char() = "ez".ToCharArray()
Dim order As var = OrderedEnumeration(Of Char).Merge(x, y, z)
Assert.AreEqual("abcdeefgiouz", New String(New List(Of Char)(order).ToArray()))
order = OrderedEnumeration(Of Char).Merge(Comparer(Of Char).[Default], DuplicateHandling.LastValueWins, x, y, z)
Assert.AreEqual("abcdefgiouz", New String(New List(Of Char)(order).ToArray()))
order = OrderedEnumeration(Of Char).Merge(Comparer(Of Char).[Default], x, y)
order = OrderedEnumeration(Of Char).WithDuplicateHandling(order, Comparer(Of Char).[Default], DuplicateHandling.FirstValueWins)
Assert.AreEqual("abcdefgiou", New String(New List(Of Char)(order).ToArray())) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also